package vista;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.awt.Color;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class FormCategoria extends javax.swing.JFrame {
	private JPanel Fondo, Fondo1, Fondo2;
	private JSeparator jSeparator1, jSeparator2;
	private JLabel jLabel1, jLabel2, jLabel3;
	private JButton bntGuardar, bntEliminar,bntCancelar, bntSalir ;
	private JTextField txtcodCategoria, txtDescripcion;
	private JButton bntBuscar;
	
	public FormCategoria() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Formulario Categoria");
			{
				Fondo = new JPanel();
				getContentPane().add(Fondo, BorderLayout.CENTER);
				getContentPane().setBackground(Color.white);
				getContentPane().add(Fondo).setBackground(Color.white);
				Fondo.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				Fondo.setPreferredSize(new java.awt.Dimension(465, 276));
				Fondo.setLayout(null);
				{
					jLabel1 = new JLabel();
					Fondo.add(jLabel1);
					jLabel1.setText("Datos Categoria ");
					jLabel1.setBounds(84, 22, 297, 33);
					jLabel1.setFont(new java.awt.Font("Purisa",1,28));
				}
				{
					jSeparator1 = new JSeparator();
					Fondo.add(jSeparator1);
					jSeparator1.setBounds(71, 55, 294, 11);
				}
				{
					Fondo2 = new JPanel();
					Fondo.add(Fondo2);
					Fondo2.setBounds(45, 72, 350, 107);
					Fondo2.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
					Fondo2.setLayout(null);
					{
						jLabel2 = new JLabel();
						Fondo2.add(jLabel2);
						jLabel2.setText("Cod. Categoria");
						jLabel2.setBounds(8, 24, 120, 18);
						jLabel2.setFont(new java.awt.Font("Dialog",0,14));
					}
					{
						jLabel3 = new JLabel();
						Fondo2.add(jLabel3);
						jLabel3.setText("Descripcion");
						jLabel3.setBounds(8, 59, 97, 24);
						jLabel3.setFont(new java.awt.Font("Dialog",0,14));
					}
					{
						txtcodCategoria = new JTextField();
						Fondo2.add(getTxtcodCategoria());
						txtcodCategoria.setBounds(128, 23, 135, 21);
					}
					{
						txtDescripcion = new JTextField();
						Fondo2.add(getTxtDescripcion());
						txtDescripcion.setBounds(128, 61, 135, 21);
					}
					{
						bntBuscar = new JButton();
						Fondo2.add(bntBuscar);
						bntBuscar.setText("B");
						bntBuscar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/buscar1.png")));
						bntBuscar.setBounds(284, 21, 53, 40);
						bntBuscar.setDoubleBuffered(false);
						bntBuscar.setFocusCycleRoot(false);
					}
				}
				{
					Fondo1 = new JPanel();
					Fondo.add(Fondo1);
					Fondo1.setBounds(20, 193, 410, 65);
					Fondo1.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
					Fondo1.setLayout(null);
					{
						bntGuardar = new JButton();
						Fondo1.add(bntGuardar);
						bntGuardar.setText("Guardar");
						bntGuardar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/aceptar.png")));
						bntGuardar.setFont(new java.awt.Font("Dialog",0,11));
						bntGuardar.setBounds(7, 14, 104, 39);
					}
					{
						bntEliminar = new JButton();
						Fondo1.add(bntEliminar);
						bntEliminar.setText("Eliminar");
						bntEliminar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/eliminar1.png")));
						bntEliminar.setFont(new java.awt.Font("Dialog",0,11));
						bntEliminar.setBounds(118, 15, 103, 38);
					}
					{
						bntCancelar = new JButton();
						Fondo1.add(bntCancelar);
						bntCancelar.setText("Cancelar");
						bntCancelar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/eliminar.png")));
						bntCancelar.setFont(new java.awt.Font("Dialog",0,11));
						bntCancelar.setBounds(228, 14, 105, 39);
					}
					{
						bntSalir = new JButton();
						Fondo1.add(bntSalir);
						bntSalir.setText("S");
						bntSalir.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/salir1.png")));
						bntSalir.setBounds(340, 13, 60, 40);
					}
				}
				{
					jSeparator2 = new JSeparator();
					Fondo.add(jSeparator2);
					jSeparator2.setBounds(71, 18, 294, 10);
				}
			}
			pack();
			this.setSize(451, 309);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void setTxtcodCategoria(String str){
		txtcodCategoria.setText(str);
	}
	
	public JTextField getTxtcodCategoria() {
		return txtcodCategoria;
	}
	
	public void setTxtDescripcion(String str){
		txtDescripcion.setText(str);
	}
	
	public JTextField getTxtDescripcion() {
		return txtDescripcion;
	}
	
	public void addListener(ActionListener actionListener,KeyListener kl) {
		this.bntBuscar.addActionListener(actionListener);
		this.bntGuardar.addActionListener(actionListener);
		this.bntEliminar.addActionListener(actionListener);
		this.bntCancelar.addActionListener(actionListener);
		this.bntSalir.addActionListener(actionListener);
	}
	
	

	public void EnabledtxtcodCategoria(boolean x)
	{
		txtcodCategoria.setEnabled(x);
	}
	
	public void EnabledBntEliminar(boolean x)
	{
		bntEliminar.setEnabled(x);
	}
	public void EnabledbntBuscar(boolean x)
	{
		bntBuscar.setEnabled(x);
	}
	public void EnabledbntGuardar(boolean x)
	{
		bntGuardar.setEnabled(x);
	}
	public void EnabledbntCancelar(boolean x)
	{
		bntCancelar.setEnabled(x);
	}
	
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
}
